# --*-- coding: utf-8 --*--

"""
Author: zhangzheng
Description: 监控构建状态
Version: 0.0.1
LastUpdateDate: 
UpadteURL: 
LOG: 
"""

import os
import psutil

from src.config.config import Config
from src.public.public import ParseXml


def running():
	"""
		获取自动化构建状态
	:return: True-正在运行, False-已停止
	"""
	xml = ParseXml(filepath=os.path.join(Config.project_dir, 'automation.data'))
	pid = xml.get_value_from_xpath(xpath='./BuildData/RunningPID', attribute='pid')
	if int(pid) in psutil.pids():
		return True
	else:
		return False


if __name__ == "__main__":
	print(running())
